<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>反转数组</title>
</head>

<body>
    反转数组
</body>
<script>
    //利用函数反转任意数组
    function reverse(arr) {
        let newArr = [];
        for (let i = arr.length - 1; i >= 0; i--) {
            newArr[newArr.length] = arr[i];
        }
        return newArr;
    };
    let arr1 = ['hello', 'how', 'are', 'you'];
    console.log(reverse(arr1));
</script>

</html>